package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/test")
public class TestController {

    @RequestMapping("/test")
    public Map test(){
        Map map = new HashMap<String,Object>();
        map.put("1","abc");
        map.put("2","def");
        return map;
    }

    @RequestMapping("/list")
    public List list(){
        List<String> list = new ArrayList<>();
        list.add("1");
        list.add("2");
        return list;
    }

    @RequestMapping("/user")
    public User user(){
        User user = new User();
        user.setName("张三");
        user.setAge(null);
        return user;
    }
}
